import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    //坏键盘打字
    public static void fun(String all,String good){
        Set<Character>set=new HashSet<>();
        for(char part1:good.toUpperCase().toCharArray()){
            set.add(part1);
        }
        Set<Character>tmp=new HashSet<>();//这个的作用是去重
       for (char part2:all.toUpperCase().toCharArray()){
           if(!set.contains(part2)&& !tmp.contains(part2)) {
               System.out.print(part2);
               tmp.add(part2);
           }
       }
    }

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        while(in.hasNextLine()){
            String s1=in.nextLine();
            String s2=in.nextLine();
            fun(s1,s2);
        }
    }
}
